package com.example.wsappproject.MvpDemo.mainpage;

import android.telecom.Call;

import com.example.wsappproject.MvpDemo.Data.IDataSource;
import com.example.wsappproject.MvpDemo.Data.Repository;
import com.example.wsappproject.practice.ArticleEntity;

import java.io.IOException;


public  class MvpPresenter implements MvpContract.Presenter{
    private final Repository Repository;
    private final MvpContract.View View;


    public MvpPresenter(Repository repository, MvpContract.View view) {
        this.Repository = repository;
        this.View = view;
    }


    @Override
    public void start() {

    }

    @Override
    public void articleList(int currentPage) {
        Repository.articleList(currentPage, new IDataSource.NetCallBack<ArticleEntity>() {
            @Override
            public void onFailure(Call call, IOException e) {

            }

            @Override
            public void onResponse(ArticleEntity entity) {
                View.showArticleList(entity);
            }
        });
    }


}
